unit Login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TF_Login = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    E_Usuario: TEdit;
    E_Pass: TEdit;
    B_Aceptar: TButton;
    B_Cancelar: TButton;
    procedure B_CancelarClick(Sender: TObject);
    procedure B_AceptarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_Login: TF_Login;

implementation

uses Otras_Tablas, Inicio, Error;

{$R *.dfm}

procedure TF_Login.B_AceptarClick(Sender: TObject);
begin
  if ((E_Usuario.Text = 'usuario') and (E_Pass.Text = '123')) then
  begin
    F_Otras_Tablas.Show;
    F_Otras_Tablas.B_Tareas.Enabled := False;
    F_Otras_Tablas.B_Emp.Enabled := False;
    F_Login.Close;
  end
  else
  if ((E_Usuario.Text = 'admin') and (E_Pass.Text = '123')) then
  begin
    F_Otras_Tablas.Show;
    F_Otras_Tablas.B_Tareas.Enabled := True;
    F_Otras_Tablas.B_Emp.Enabled := True;
    F_Login.Close;
  end
  else
    F_Error.ShowModal;
end;

procedure TF_Login.B_CancelarClick(Sender: TObject);
begin
  F_Login.Close;
end;

procedure TF_Login.FormActivate(Sender: TObject);
begin
  E_Usuario.SetFocus;
  E_Pass.Text := '';
end;

end.
